package com.example.usb.thread;

import com.example.usb.dao.entity.PhotoPicBean;
import com.example.usb.dao.util.PhotoPicDaoUtil;
import com.example.usb.util.AiV3Util;

import java.util.List;

/**
 * Created Date 2019/2/28.
 *
 * @author liangkun
 * ClassDescription：图片识别
 */
public class FaceThread implements Runnable {
    @Override
    public void run() {

        while (true) {
            List<PhotoPicBean> picBeans = PhotoPicDaoUtil.getInstance().getNotFaceDetection();
            if (picBeans.size() > 0) {
                for (int i = 0; i < picBeans.size(); i++) {
//                    DebugLog.d(DebugLog.LOGHsc+" size  "+picBeans.size()+" path "+picBeans.get(i).getFileName() );
                    PhotoPicBean photoPicBean = picBeans.get(i);
                    String md5 = photoPicBean.getMd5();
                    String filePath = photoPicBean.getFilePath();
                    try {
                        AiV3Util.getInstance().getManage(md5, filePath, photoPicBean);
                    } catch (Exception mE) {
                        mE.printStackTrace();
                    }
                }
            }
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


    }
}
